package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstUserPayLogDao;
import com.financing.wap.dto.DstUserPayLogDTO;
import com.financing.wap.service.IDstUserPayLogService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_user_pay_log  
 * 用户支付流水 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstUserPayLogService")
public class DstUserPayLogServiceImpl implements IDstUserPayLogService{

	@Autowired
	private IDstUserPayLogDao dstUserPayLogDao;

	@Override
	public int insert(DstUserPayLogDTO dstUserPayLog) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstUserPayLog);
		DTOdateSetUtil.setUpdateInfo(dstUserPayLog);
		dstUserPayLog.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstUserPayLogDao.insert(dstUserPayLog);
	}

	@Override
	public void update(DstUserPayLogDTO dstUserPayLog) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserPayLog);
		dstUserPayLogDao.update(dstUserPayLog);
	}

	@Override
	public void updateForce(DstUserPayLogDTO dstUserPayLog) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserPayLog);
		dstUserPayLogDao.updateForce(dstUserPayLog);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstUserPayLogDao.delete(id);
	}
	
	@Override
	public List<DstUserPayLogDTO> queryList(DstUserPayLogDTO dstUserPayLog) throws SQLException {
		return dstUserPayLogDao.queryList(dstUserPayLog);
	}

	@Override
	public int queryListCount(DstUserPayLogDTO dstUserPayLog) throws SQLException {
		return dstUserPayLogDao.queryListCount(dstUserPayLog);
	}

	@Override
	public DstUserPayLogDTO loadById(Integer id) throws SQLException {
		return dstUserPayLogDao.loadById(id);
	}
 	@Override
	public DstUserPayLogDTO queryListGetFirst(DstUserPayLogDTO dstUserPayLog)
			throws SQLException {
		 List<DstUserPayLogDTO> queryList = queryList(dstUserPayLog);
		 if(queryList==null||queryList.size()==0){
			 return new DstUserPayLogDTO();
		 }
		 return queryList.get(0);
	}
}
